package com.wangzha.common.enums;


public enum TaskStatusEnum {
    READY_TO_RUN(1,"准备运行"),
    IN_OPERATION(2,"运行中"),
    END(3,"运行结束");

    int state;
    String desc;
    TaskStatusEnum(int state, String desc) {
        this.state = state;
        this.desc = desc;
    }

    public int getState() {
        return state;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescByType(Integer state) {
        if (state == null) {
            return null;
        }
        for (TaskStatusEnum taskStatusEnum : TaskStatusEnum.values()) {
            if (taskStatusEnum.getState() == state) {
                return taskStatusEnum.getDesc();
            }
        }
        return null;
    }
}
